package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Weibo;
import cn.tedu._04mybatis.pojo.vo.*;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

@Mapper
public interface WeiboMapper {
    /**
     * 增删改查操作
     */
    //@Insert("INSERT INTO weibo(content, created, user_id) VALUES (#{content},#{created},#{userId})")
    int insertWeibo(Weibo weibo);
    //@Delete("DELETE FROM weibo WHERE id = #{wid}")
    int deleteWeibo(Long wid);
    //@Update("UPDATE weibo SET content = #{content} , created =#{created} ,user_id = #{userId} WHERE id = #{id}")
    int updateWeibo(Weibo weibo);
    /*
    单条全字段查询
     */
    //@Select("SELECT id ,content , created , user_id userId FROM weibo WHERE id =#{wid}")
    Weibo selectWeibo(Long wid);
    /*
    多条全字段查询
     */
    //@Select("SELECT id ,content , created , user_id userId FROM weibo WHERE user_id =#{uid}")
    List<Weibo> selectWeiboUserId(Long uid);
    /*
    单条部分字段查询
     */
    //@Select("SELECT content ,created FROM weibo WHERE id =#{id}")
    WeiboVO selectWeiboVoById(Long id);
    /*
    多条部分字段查询
     */
    //@Select("SELECT content , user_id userId FROM weibo")
    List<WeiboVO2> selectWeiboAll();
    /*
    动态修改:根据微博id动态修改该条微博信息
     */
    int dynamicUpdate(Weibo weibo);
    /*
    动态删除:数组方式删除多条微博
     */
     int deleteWeiboByIds1(Long[] ids);
     /*
     动态删除:集合类型
      */
    int deleteWeiboByIds2(List<Long> ids);
    /*
    统计数量
     */
    int countWeibo();
    /*resultmap单表
    * */
    ResultMapVO1 selectMap(Long id);
    /*resultMap 多表*/
    ResultMapVO2 selectMap2(Long uid );
    /*练习*/
    ResultMapVO3 selectMap3(Long wid);
    /*练习*/
    ResultMapVO4 selectMap4(Long wid);
}
